package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyDemo2 {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("b.txt");
        FileOutputStream fos = new FileOutputStream("d.txt");
        int len;

        byte[] bytes = new byte[1024];

        long start = System.currentTimeMillis();

        while ((len = fis.read(bytes))!= -1){
            fos.write(len);
        }
        long end = System.currentTimeMillis();
        System.out.println(end-start);
        fos.close();
        fis.close();
    }

}
